package com.j180.service.detail.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.j180.bean.Detail;
import com.j180.dao.detail.IDetailDao;
import com.j180.service.detail.IDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DetailServiceImpl implements IDetailService {

    @Autowired
    private IDetailDao iDetailDao;

    @Override
    public List<Detail> showDetailAllInfo(int curpage, int pageSize) {
        PageHelper.startPage(curpage,pageSize);
        List<Detail> list = iDetailDao.getDetailAll();
        //PageInfo pageInfo = new PageInfo(list);


        return list;
    }

    @Override
    public Detail showDetailByIdInfo(int id) {


        return iDetailDao.getDetailById(id);
    }

    @Override
    public int addDetailInfo(Detail detail) {


        return iDetailDao.insertDetail(detail);
    }

    @Override
    public int updateDetailInfo(Detail detail) {
        return iDetailDao.upDetail(detail);
    }

    @Override
    public int deleteDetailByIdInfo(int id) {


        return iDetailDao.delDetailById(id);
    }
}
